<template>
  <div id="app">
    <el-container class="layout-container">
      <!-- 侧边栏菜单 -->
      <el-aside width="250px" class="sidebar">
        <div class="logo">
          <h2>员工能力评估系统</h2>
        </div>
        <el-menu
          :default-active="activeMenu"
          router
          class="sidebar-menu"
          background-color="#304156"
          text-color="#bfcbd9"
          active-text-color="#409EFF"
        >
          <el-menu-item index="/employee-data">
            <el-icon><User /></el-icon>
            <span>员工数据整合分析</span>
          </el-menu-item>
          <el-menu-item index="/competency">
            <el-icon><TrendCharts /></el-icon>
            <span>岗位胜任力判断</span>
          </el-menu-item>
          <el-menu-item index="/position">
            <el-icon><User /></el-icon>
            <span>岗位要求管理</span>
          </el-menu-item>
          <el-menu-item index="/development">
            <el-icon><Opportunity /></el-icon>
            <span>能力评估与发展建议</span>
          </el-menu-item>
        </el-menu>
      </el-aside>

      <!-- 主内容区域 -->
      <el-container>
        <el-header class="header">
          <div class="header-left">
            <h3>{{ currentRouteTitle }}</h3>
          </div>
          <div class="header-right">
            <el-text>员工能力多维度评估系统</el-text>
          </div>
        </el-header>

        <el-main class="main-content">
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { computed } from "vue";
import { useRoute } from "vue-router";
import { User, TrendCharts, Opportunity } from "@element-plus/icons-vue";

export default {
  name: "App",
  components: {
    User,
    TrendCharts,
    Opportunity,
  },
  setup() {
    const route = useRoute();

    const activeMenu = computed(() => route.path);
    const currentRouteTitle = computed(
      () => route.meta.title || "员工能力评估系统"
    );

    return {
      activeMenu,
      currentRouteTitle,
    };
  },
};
</script>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#app {
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", Arial, sans-serif;
  height: 100vh;
}

.layout-container {
  height: 100vh;
}

.sidebar {
  background-color: #304156;
  box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35);
}

.logo {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #2b3a4a;
}

.logo h2 {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
}

.sidebar-menu {
  border: none;
}

.header {
  background-color: #fff;
  border-bottom: 1px solid #e6e6e6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
}

.header-left h3 {
  color: #303133;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
}

.main-content {
  background-color: #f0f2f5;
  padding: 20px;
  overflow-y: auto;
}

/* 自定义滚动条 */
.main-content::-webkit-scrollbar {
  width: 6px;
}

.main-content::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.main-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.main-content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
</style>
